package com.ruoyi.project.ums.service;

import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.ums.mapper.UmsSearchHistoryMapper;
import com.ruoyi.db.ums.domain.UmsSearchHistory;
import com.ruoyi.db.ums.domain.query.UmsSearchHistoryQueryVo;

/**
 * 搜索历史Service业务层处理
 *
 * @author ruoyi
 * @date 2020-04-26
 */
@Service
public class UmsSearchHistoryService
{
    @Autowired
    private UmsSearchHistoryMapper umsSearchHistoryMapper;

    /**
     * 查询搜索历史
     *
     * @param id 搜索历史ID
     * @return 搜索历史
     */
    public UmsSearchHistory selectUmsSearchHistoryById(Long id)
    {
        return umsSearchHistoryMapper.selectUmsSearchHistoryById(id);
    }

    /**
     * 查询搜索历史列表
     *
     * @param umsSearchHistory 搜索历史
     * @return 搜索历史
     */
    public List<UmsSearchHistory> selectUmsSearchHistoryList(UmsSearchHistoryQueryVo umsSearchHistoryQueryVo)
    {
        return umsSearchHistoryMapper.selectUmsSearchHistoryList(umsSearchHistoryQueryVo);
    }

    /**
     * 新增搜索历史
     *
     * @param umsSearchHistory 搜索历史
     * @return 结果
     */
    public int insertUmsSearchHistory(UmsSearchHistory umsSearchHistory)
    {
        return umsSearchHistoryMapper.insertUmsSearchHistory(umsSearchHistory);
    }

    /**
     * 修改搜索历史
     *
     * @param umsSearchHistory 搜索历史
     * @return 结果
     */
    public int updateUmsSearchHistory(UmsSearchHistory umsSearchHistory)
    {
        umsSearchHistory.setUpdateTime(LocalDateTime.now());
        return umsSearchHistoryMapper.updateUmsSearchHistory(umsSearchHistory);
    }

    /**
     * 批量删除搜索历史
     *
     * @param ids 需要删除的搜索历史ID
     * @return 结果
     */
    public int deleteUmsSearchHistoryByIds(Long[] ids)
    {
        return umsSearchHistoryMapper.deleteUmsSearchHistoryByIds(ids);
    }

    /**
     * 删除搜索历史信息
     *
     * @param id 搜索历史ID
     * @return 结果
     */
    public int deleteUmsSearchHistoryById(Long id)
    {
        return umsSearchHistoryMapper.deleteUmsSearchHistoryById(id);
    }
}
